/********************************Copyright (c)**********************************\
**
**                   (c) Copyright 2019, Main, China, QD.
**                           All Rights Reserved
**
**                                 By(wo4fisher)
**                           http://www.wo4fisher.com
\********************************End of Head************************************/

#ifndef APP_WATCHDOG_H_
#define APP_WATCHDOG_H_

#include <msp430.h>
#include "define.h"

/*              bit_pos
 * WDTHOLD      7       0:Watchdog timer is not stopped;    1:Watchdog timer is stopped
 * WDTNMIES     6       0:NMI on rising edge;               1:NMI on falling edge
 * WDTNMI       5       0:Reset function                    1:NMI function
 * WDTTMSEL     4       0:Watchdog mode                     1:Interval timer mode
 * WDTCNTCL     3       0:No action                         1:WDTCNT = 0000h
 * WDTSSEL      2       0:SMCLK                             1:ACLK
 * WDTISx       1&0     00:Watchdog clock source /32768     01: /8192       10:  /512       11:   /64
 */

#define START_WDT()  (WDTCTL = WDT_ARST_1000)  //ACLK/32768=1S  //WDT_ARST_1000 = WDTPW+WDTCNTCL+WDTSSEL
#define STOP_WDT()   (WDTCTL = WDTPW | WDTHOLD)
#define CLR_WDT()    (WDTCTL = WDT_ARST_1000)


#endif /* APP_WATCHDOG_H_ */
/**********  end of file *******/
